var locationType = {
		"7":"地铁站",
		"8":"商业地点",
		"9":"小区",
		"10":"公交车站"
}
var rentTimeType = {
		"4":"短租",
		"5":"长租"
}
var HomeDetail=({
	queryHomeDetailByHouseId:function(){
		var search = $("#search").val();
		$.ajax({
			type : "POST",
			dataType : 'json',
			url : path + "/house/queryHomeDetailByHouseId.do",
			data : {
				//"houseId":"a1"
				"houseId":houseId
			},
			success : function(data) {
				var html ="";
				if(data.result){
					//轮播图片
					if(data.houseImg.length>0){
						var imgHtml = "";
						$("#imagesUl").html("");
						$(data.houseImg).each(function(i,n){
							imgHtml+="<li data-background='"+path+"/images/houseDetail/"+n.imgUrl+"' style='height: 160px'></li>";
						})
						$("#imagesUl").html(imgHtml);
					}
					//详情
					if(data.houseDetail.length>0){
						var res = data.houseDetail[0];
						$("#title").text(res.houseName);
						$("#price").text("￥"+res.price+"/月");
						$("#jl").text("距离"+res.flagName+res.distance+"米");
						$("#size").text(""+res.houseSize+"㎡（建筑面积）");
						$("#houseLayout").text(res.layout);
						$("#elevator").text(res.elevator == 1?"有":"无");
						$("#towards").text(res.toward);
						$("#floor").text(res.floor+"/"+res.allFloor);
						$("#canStay").text("预计"+formatDateTime(res.checkIn)+"可入住");
						$("#rent").text(rentTimeType[res.rentTimeType]+res.RentTime);
						$("#yajin").text(res.yj);
						$("#houseDesc").text(res.desc);
						$("#headImg").html("<img src='"+path+"/images/user/"+res.headImg+"' style='margin-top: 0%;float: left;width: 25%;padding-left: 8px;padding-top: 10px'/>");
						$("#personalMsg").text(res.msg);
						$("#communityImg").html("<img src='"+path+"/images/community/"+res.communityUrl+"' style='margin-top: 0%;float: left;width: 25%;padding-left: 8px;padding-top: 10px'/>");
						$("#communityName").text(res.community);
						$("#communityDesc").text(res.communityDesc);
					}
					//特征
					if(data.houseFlag.length>0){
						var flagHtml = "";
						$("#flag").html("");
						$(data.houseFlag).each(function(i,n){
							flagHtml+="<span class='span_css'>"+n.flagName+"</span>&nbsp;&nbsp;";
						})
						$("#flag").html(flagHtml);
					}
					//交通
					if(data.houseLocation.length>0){
						var locationHtml = "";
						$("#locationUl").html("");
						$(data.houseLocation).each(function(i,n){
							locationHtml+="<li style='padding-left: 10px;height: 30px;'>距离"+n.flagName+locationType[n.type]+n.distance+"米</li>";
						})
						$("#locationUl").html(locationHtml);
					}
				}else{
					mui.alert("查询详情出错，请联系管理员")
				}
			}
		});
	},
})
/**
 * 时间戳转yyyy-MM-dd
 * @param inputTime
 * @returns
 */
function formatDateTime(inputTime) {  
    var date = new Date(inputTime);
    var y = date.getFullYear();  
    var m = date.getMonth() + 1;  
    m = m < 10 ? ('0' + m) : m;  
    var d = date.getDate();  
    d = d < 10 ? ('0' + d) : d;  
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;  
    second = second < 10 ? ('0' + second) : second; 
    return y + '-' + m + '-' + d;  
   // return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;  
};